package org.xa3apm.vote.servlets;

import java.io.IOException;

import javax.ejb.EJB;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.xa3apm.vote.bean.db.InitPerson;

/**
 * Servlet implementation class InitDBServlet
 */
@WebServlet("/InitDBServlet")
public class InitDBServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
	@EJB
	InitPerson initPerson;

	// @EJB
	// InitBlagoevgrad blagoevgrad;
	// @EJB
	// InitBurgas burgas;
	// @EJB
	// InitGabrovo gabrovo;
	// @EJB
	// InitDobrich dobrich;
	// @EJB
	// InitHaskovo haskovo;
	// @EJB
	// InitKardjali kardjali;

	protected void processRequest(HttpServletRequest request,
			HttpServletResponse response) {
		// blagoevgrad.initDb();
		// burgas.init();
		// gabrovo.init();
		// dobrich.init();
		// haskovo.init();
		// kardjali.init();
		initPerson.initPersons();

	}

	/**
	 * @see HttpServlet#HttpServlet()
	 */
	public InitDBServlet() {
		super();
	}

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
	 *      response)
	 */
	protected void doGet(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		processRequest(request, response);
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse
	 *      response)
	 */
	protected void doPost(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		processRequest(request, response);
	}

}
